package com.wangzhixuan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wangzhixuan.commons.result.PageInfo;
import com.wangzhixuan.mapper.SysLogMapper;
import com.wangzhixuan.model.SysLog;
import com.wangzhixuan.service.ISysLogService;
import org.springframework.stereotype.Service;

/**
 * SysLog 表数据服务层接口实现类
 */
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements ISysLogService {

    @Override
    public void selectDataGrid(PageInfo<SysLog> pageInfo) {
        Page<SysLog> page = new Page<SysLog>(pageInfo.getNowpage(), pageInfo.getSize());
        QueryWrapper<SysLog> wrapper = new QueryWrapper<>();
        wrapper.orderBy(false, pageInfo.getOrder().equalsIgnoreCase("ASC"), pageInfo.getSort());
        page(page, wrapper);
        pageInfo.setRows(page.getRecords());
        pageInfo.setTotal(page.getTotal());
    }

}